package com.ijiuchuang.jc_localization.presenter.settings;

import android.content.Context;

import com.ijiuchuang.jc_localization.bean.lite.Map;
import com.ijiuchuang.jc_localization.contract.settings.SettsLocationContract;
import com.ijiuchuang.jc_localization.model.settings.SettsLocationModel;

import rx.Subscriber;
import rx.functions.Action1;

/**
 * Created by Veev on 2016/6/20
 *
 * @link 384506557@qq.com
 */
public class SettsLocationPresenter implements SettsLocationContract.Presenter {

    private Context mContext;
    private SettsLocationContract.View mView;
    private SettsLocationContract.Model mModel;

    public SettsLocationPresenter(Context mContext, SettsLocationContract.View mView) {
        this.mContext = mContext;
        this.mView = mView;
        mModel = new SettsLocationModel();

        mView.setPresenter(this);
    }

    @Override
    public void start() {
        // start here
        mModel.getDefaultScene(new Subscriber<Map>() {
            @Override
            public void onCompleted() {
                mView.setSceneName("-- 未设置 --");
            }

            @Override
            public void onError(Throwable e) {
                mView.setSceneName("-- 未设置 --");
            }

            @Override
            public void onNext(Map map) {
                mView.setSceneName(map.getName());
            }
        });
    }

}